package com.combetter.changxing.ui.fragment;

import android.content.Intent;

import com.combetter.changxing.R;
import com.combetter.changxing.databinding.FragmentRegisterBinding;
import com.combetter.changxing.ui.base.BaseFragment;
import com.combetter.changxing.ui.dialog.BelowSelectDialog;
import com.combetter.changxing.ui.dialog.CityListDialog;
import com.combetter.changxing.viewmodel.RegisterViewModel;


import static com.combetter.changxing.constanst.Constants.REUEST_CODDE;

/**
 * 注册Fragment
 * <p>
 * Created by 深圳唐龙飞讯科技有限公司 on 2018/6/6.
 */
public class RegisterFragment extends BaseFragment<FragmentRegisterBinding, RegisterViewModel> {

    @Override
    public int setLayout() {
        return R.layout.fragment_register;
    }

    @Override
    public void init() {

    }

    @Override
    public Class createViewModel() {
        return RegisterViewModel.class;
    }

    @Override
    public void loadData() {
        onClick();
    }

    private void onClick() {

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REUEST_CODDE) {
            String stringExtra = data.getStringExtra(BelowSelectDialog.REQUESE);
            int titleId = data.getIntExtra(BelowSelectDialog.REQUESEID, 0);
            if (titleId == getViewModel().sexId) {
                mViewModel.sex.set(stringExtra);
            }
            int cityId = data.getIntExtra("cityId", 0);
            if (cityId == CityListDialog.cityId) {
                String cityName = data.getStringExtra("cityName");
                mViewModel.city.set(cityName);
            }
        }

    }


}
